# 货物摆放
import math


def counts(n):
    factors = set()  # 查找所有的因数
    for i in range(1, int(math.sqrt(n)) + 1):
        if n % i == 0:
            factors.add(i)
            factors.add(n // i)

    # 遍历所有的因数的组合
    factors = list(factors)
    cnt = 0
    for i in factors:
        for j in factors:
            if n % (i * j) == 0:
                cnt += 1
    return cnt


def count_opt(n):
    # 求所有质数的因子
    prime_factor = []
    i = 2
    x = n
    while i < pow(x + 1, 0.5):
        if x % i == 0:
            prime_factor.append(i)
            x = x // i
        else:
            i += 1
    prime_factor.append(x)

    # 求所有整数因子
    factors = set()
    factors.add(1)
    for j in prime_factor:
        p = set()
        for k in factors:
            p.add(j * k)
        factors.update(p)

    count = 0
    for k1 in factors:  # 遍历两层求解
        for k2 in factors:
            if n % (k1 * k2) == 0:
                count += 1
    return count


if __name__ == '__main__':
    # n = int(input())
    print(counts(4))
    print(counts(6))
    print(counts(2021041820210418))
    print(count_opt(12))
    print(count_opt(2021041820210418))
